home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16085 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  38 lines

  1. Path: ix.netcom.com!news
  2. From: bfasula@ix.netcom.com(William T. Fasula Jr. )
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: file descriptors and fstreams...
  5. Date: 9 Apr 1996 00:46:11 GMT
  6. Organization: Netcom
  7. Message-ID: <4kcc0j$29q@dfw-ixnews2.ix.netcom.com>
  8. References: <4k780i$dd5@beyond.escape.com>
  9. NNTP-Posting-Host: nhv-ct4-09.ix.netcom.com
  10. X-NETCOM-Date: Mon Apr 08  7:46:11 PM CDT 1996
  11.  
  12. In <4k780i$dd5@beyond.escape.com> ward@escape.com (Christian Ward)
  13. writes: 
  14. >
  15. >
  16. >Hi I'm a very beginner c++ programmer, although I've been doing C for
  17. a
  18. >while. I know there's a C function called fdopen which takes a file
  19. >descriptor and creates a stream for it so you can use fprintf, fscanf,
  20. >and all that other good stuff. Is there a similar function (or
  21. whatever)
  22. >that takes a file descriptor and does something to let you use << and
  23. >>
  24. >with it?
  25. >
  26. >Like I said I'm very new to C++ and I'm sorry that I don't have the
  27. >correct terminology for all this stuff.
  28. >
  29. >Justin
  30.  
  31.  You can use the ifstream and ofstream for file input and output.
  32. #include <fstream.h>
  33. void main()
  34. {
  35.     ofstream ofile("test.dat");
  36.     ofile << "Test data";
  37. }
  38.